package com.lujieni.springbootcaffeine.service;

import com.lujieni.springbootcaffeine.cache.ITTLCaffeineCacheProvider;
import com.lujieni.springbootcaffeine.dao.StudentDao;
import com.lujieni.springbootcaffeine.po.StudentPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StudentCaffeineCacheProvider implements ITTLCaffeineCacheProvider<String, StudentPO> {

    @Autowired
    private StudentDao studentDao;


    /**
     * 根据key获取缓存数据的获取方法
     *
     * @param key
     * @return
     * @author 陈宇霖
     * @date 2018年01月22日09:18:27
     */
    @Override
    public StudentPO get(String key) {
        return studentDao.selectByPrimaryKey(key);
    }

}
